package controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
public class Login {
	
	@RequestMapping("/chatroom")
	public String chatroom(@RequestParam("id") String uid,HttpSession session){
//		session.setAttribute("username", username);
		session.setAttribute("uid", uid);
		if("1".equals(uid)){
			return "chatroom";
		}else{
			return "chatroom2";
		}
	}
	
	@RequestMapping("/login")
	public String login(){
		return "login";
	}
	
	@RequestMapping("/logout")
	public String logout(HttpSession httpSession){
		httpSession.removeAttribute("username");
		httpSession.removeAttribute("uid");
		return "login";
	}
  }
